package com.woniuxy.purchase.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniuxy.purchase.entity.pojo.BuyDemand;
import com.woniuxy.purchase.entity.vo.DemandDetailsVO;
import com.woniuxy.purchase.entity.vo.TopDemandVO;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BuyDemandMapper extends BaseMapper<BuyDemand> {


    List<DemandDetailsVO> findDemandDetails(Integer id);

    @Select("select count(*) from user where account = #{account} and cellphone = #{phone}")
    Integer findPhoneByAccount(@Param("phone") String phoneNumber, @Param("account") String account);

    @Update("update user set password = #{pwd} where account=#{account}")
    void updatePwdByAccount(@Param("pwd") String newPwd,@Param("account") String account);

    @Insert("insert into export_table(account,export_time,table_name) values (#{account},#{time},#{demand})")
    void insertLog(@Param("account") String account, @Param("time") String time, @Param("demand") String demand);

    List<TopDemandVO> getTopDemand();
}
